MacLayers Operation Starting The MacLayers Protocol The MacLayers application on the Macintosh starts up as a generic host-to-terminal VT100 emulator. (As such you can run it with any host, although much more powerful terminal programs exist for this purpose.) Baud rate and other configurations are set by selections under the Control menu. Under System 6.0.x, MultiFinder is fully supported so you can use other applications while MacLayers is executing and downloading. MacLayers is also System 7 friendly. To experiment, login as you normally would to your UNIX host and then run the layers UNIX command (see Chapter 3, "Installation") to start the MacLayers multi-window protocol. If all goes well, the initial login window will disappear, a dialog box indicating the layers protocol is starting up will be displayed and then replaced by a new single window. Everything will look as it did before you ran layers, except that, now, you can create more shell windows with the "New" Layer menu pick, or by running the layers command again from an existing window. Dialing and Modem Settings In order to use the MacLayers dialing command, you must enter a phone number into the "Phone Settings" dialog box under the Phone menu. If your modem requires any initialization commands, you should place these in the appropriate box in the same dialog. Control characters can be placed in this strings using the ^A convention; for example, ^M (the character '^' followed by 'M') will cause a carriage-return to be sent. The modem initialization string is sent once, at startup, when you double-click on a settings document to start MacLayers; the string is not sent if you open the settings document via the File menu. As an example, "ATZ^M", when used as a modem initialization string, would cause the modem state to be reset to its default power-on state. Do not change the dial-prefix string in the "Phone Settings" dialog unless you know what you are doing. Saving Settings Settings are saved separately from window contents in MacLayers startup documents (This is different from previous versions of MacLayers). Settings include things like baud rate, initial window position and size, modem and dial strings, download directory, etc. Settings are saved using the "Save Settings" menu pick from the File menu. It is recommended that you store your settings in a variety of settings startup documents, one per phone number, and start MacLayers by double-clicking on these documents from the Finder. You can also open and use a settings file using the "Open" menu pick in the file menu. However, this option is available only when the layers protocol is not running. The reason is that communications settings may not be changed when the layers protocol is active. MacLayers can optionally mantain text logfiles for each window. If "Save Logfiles by Default" is checked in the Preferences dialog, MacLayers will save these logfiles across logins; otherwise, they are deleted. At any time, the text content of any layers window can be saved to a new always permenant file using the "Save Logfile As" menu pick from the File menu; this new file will become the active logfile for the current layer until it is closed. The layers Command Once the initial 'layers' command is executed on the host (use no options or parameters) MacLayers and the host start communicating using MacLayers protocol mode. Automatically, the document file window is closed and reopened as layer number 1 running with a new shell. The shell is specified by your $SHELL environment variable; otherwise, /bin/sh is used. The term 'layer' refers to a process group running on the Unix host and the associated MacLayers window to which the group is attached. The Macintosh Layer menu list shows the status of currently opened layers and read-only text files (described later). Selecting the menu item brings the associated window up front. Layer number 1 is a little special. Its shell identifies itself to the host as your login shell (if layers has been installed 'setuid') so that broadcast messages and commands like 'talk' and 'write' will be properly redirected to that window. (The current mesg(1) state remains unchanged.) You can start a new shell layer via the New menu item from the Layers menu. You can also start a new layer window by issuing the 'layers' command in any shell layer window. If you provide command-line options to layers, the new layer window will starting running your default shell. However, instead of a shell you can specify any command you wish by simply adding it as a parameter. Examples: % layers mail % layers telnet earth You can also elect to have the new window be a login shell by adding a -l option. This allows broadcast/write/talk capabilities for that window (on most systems) by adding the associated tty to the /etc/utmp or equivalent system file. By default, only the first layer (number 1) starts out as a login shell. This default behavoir can be changed by setting a compile-time flag in the layers.c source. Window Sizing and "VI" mode The host is always kept informed of your current window size and programs using curses(3) (such as 'vi' and 'more') will properly adapt. However, most UNIX programs only size the window once when they start up, so changing the window size is verboten after they are running. MacLayers normally disallows window resizing when it recognizes that you are running such a program. A 'vi' symbol appears in the lower right window 'growbox' area when MacLayers detects you are running a cursor moving type of program. This can be overridden by holding down the shift key when resizing the window. Zooming is also disallowed at this time unless both the zoomed and non-zoomed state have exactly the same character line width and height. See the section "Logging Into Another Host" below for information on proper window sizing when your window is being used to do a login command into another host. Note: You may have to hit return once after some programs terminate to get MacLayers to recognize you are out of 'vi' mode. The goal is to force some text to scroll off the top of the layer window. Closing Windows A window will be closed when the process running in it is exited; this is the normal and expected way to close layers. You can also force termination of the window's processes with the Layers menu "SIGTERM/SIGHUP Layer" pick. The layer may also be killed by explicitly closing its window (which causes SIGHUP to be sent). When a layer process group terminates on the host, its window is automatically closed. MacLayers exits layers mode when the last layer window is closed. You may also use the Layers menu "Shutdown" to terminate layers mode. You cannot quit the MacLayers application while in layers mode but must shutdown the multi-window mode first. You can abort host layers by using the Control menu "Abort Host Layers" item which is always available. This causes the host layers program, which you ran to initially drop into layers mode, to be terminated. This may be necessary if your Macintosh loses contact with the host (for example, a local power failure) in such a way as to leave the host still running layers. If the MacLayers application aborts due to a non-recoverable problem it will inform the host to terminate layers mode before returning to the Finder. More About Window Sizing Each MacLayers window has two complete window size environments, a zoomed state size and a non-zoomed state size. Each state may have its own associated font size and screen location. Clicking the zoom box in the title bar switches between the two states. Simply moving a window doesn't change its state. Both the font and size for the two states can be set by the Control menu "Default Window Settings" and "Current Window Settings" items. The default item settings are used when any new windows are created. MacLayers automatically communicates changes in window size to the UNIX layers program during layers mode. Logging Into A Secondary Host If you log onto another system from within a layer window, then your shell on that system may not know of your current window's size. MacLayers provides you with a way to inform that system of this information if the system runs BSD or System V Unix. For remote BSD systems you can execute the 'layersize' command provided with this package. (The command must be copied to or built on the remote system and be accessible by your shell there.) When you are at the shell command prompt, select the Control menu item "Inform BSD of Window Size" inside MacLayers. A string will be sent invoking the 'layersize' UNIX program; this informs the remote kernel of the current process window size. If you are using 'tset' inside your .login or .profile file to set the terminal type upon login, you can avoid most of these problems by giving it the -I option which will keep 'tset' from forcing each login window to be treated as always having 24 lines (the vt-100 default). For example, the author uses the following three lines inside his .login file (under SunOS) to set terminal type. set noglob eval `tset - -Q - -s -k -r -I -m 'dialup:vt100' -m 'network:vt100'` unset noglob System V allows window (actually screen) sizes to be specified with the environment variables "COLUMNS" and "LINES". You can automatically set these shell variables when at a shell command prompt by selecting the Control menu "Inform System V of Window Size" item. It is up to you to inform the indirect login host of any window size changes by using the menu items. Your terminal type on such hosts should be specified as vt100 if you wish to execute screen oriented commands such as 'vi' or 'more'. Other Capabilities Cursor Positioning Within 'vi' and 'emacs': MacLayers can be configured to send cursor position information for either 'vi' or 'emacs' when you double-click in a layers window. By default, MacLayers will not send any cursor positining information, so you will need to choose your favorite editor in the Terminal settings dialog. For 'vi' users, the process of sending cursor-positioning information is transparent to the user. First, make sure you have selected 'vi cursor-position' for "Double-clicks in window send:" in the Terminal dialog box. Then, to try it out, startup 'vi' and edit a file. Press [ESC] to insure you are not in vi insert mode and double-click at some position in the window. You should see the vi cursor jump to the nearest legal cursor position. For fun, you can double-click while in vi insert mode (or at the shell) to see what MacLayers sends when you double-click. For users of the Free Software Foundation's GNU emacs, taking advantage of mouse-support requires some setup. In particular, you must use the emacs "load-file" command to load the emacs-lisp file "macmouse.el" before cursor positioning will work. Or, you can put a call to autoload the file into your .emacs file. This approach is recommended. Here is the right line. (autoload 'move-mac-cursor "~/emacs/macmouse.el" "" t nil) MacLayers 1.30 uses the same macmouse.el as the terminal emulator uw. This may change in the future. At this time, MacLayers supports only the mouse cursor positioning features of macmouse.el. None of the other functions mentioned in macmouse.el are supported. Note: You can use the emacs "byte-compile-file" function to create a compiled version of macmouse.el called macmouse.elc. This file can be autoloaded as mentioned above. Read-only Text Files MacLayers can open up text files as read-only windows by using the "Open Text" File menu. Such windows can have their contents copied to the clipboard but may never be altered in any way. Text window titles show the ® symbol to let you know they are read-only and a "no-write" symbol appears at the bottom right portion of the window (the "grow" area.) Window Aliasing At times you may wish to view two portions of a layer window's contents at one time. The File menu "Open Window Alias" will create a new read-only window for any communications window and this can be scrolled to any independent position desired, just like a text-only window. Since in-coming text from the computer always forces a window to the bottom for proper capturing, the window aliasing feature can be used to open a surrogate window that is immune to this action. Window aliases are automatically closed when their parent window is closed.